home *** CD-ROM | disk | FTP | other *** search
/ MacWarehouse Macintosh Games / MacWarehouse Macintosh Games.iso / AMBER demo / ROXY / ROXY.dxr / 00003_more custom domain rules.ls < prev    next >
Encoding:
Text File  |  1996-10-18  |  11.4 KB  |  332 lines

  1. on setBarMode whichOne
  2.   global oStoryteller, oPuppeteer
  3.   cursorOff()
  4.   set oldMode to getState(oStoryteller, #BarMode)
  5.   if whichOne = #power then
  6.     set buttonStack to getProp(the lsMultiFrames of oPuppeteer, #barButtons)
  7.     set multiFrameSprite to 0
  8.     repeat with i = 10 to 48
  9.       if getPos(buttonStack, the castNum of sprite i) then
  10.         set multiFrameSprite to i
  11.         exit repeat
  12.       end if
  13.     end repeat
  14.     set the castNum of sprite multiFrameSprite to cast getAt(buttonStack, 6)
  15.     startTimer()
  16.     updateStage()
  17.     if oldMode = #runOFF then
  18.       set newMode to #runON
  19.     end if
  20.     if oldMode = #runON then
  21.       set newMode to #runOFF
  22.     end if
  23.     if oldMode = #setOFF then
  24.       set newMode to #setON
  25.     end if
  26.     if oldMode = #setON then
  27.       set newMode to #setOFF
  28.     end if
  29.     repeat while the timer < 2
  30.       nothing()
  31.     end repeat
  32.     set the castNum of sprite multiFrameSprite to cast getAt(buttonStack, 2)
  33.   else
  34.     set buttonStack to getProp(the lsMultiFrames of oPuppeteer, #barSwitch)
  35.     set multiFrameSprite to 0
  36.     repeat with i = 10 to 48
  37.       if getPos(buttonStack, the castNum of sprite i) then
  38.         set multiFrameSprite to i
  39.         exit repeat
  40.       end if
  41.     end repeat
  42.     if oldMode = #runOFF then
  43.       set newMode to #setOFF
  44.     end if
  45.     if oldMode = #runON then
  46.       set newMode to #setON
  47.     end if
  48.     if oldMode = #setOFF then
  49.       set newMode to #runOFF
  50.     end if
  51.     if oldMode = #setON then
  52.       set newMode to #runON
  53.     end if
  54.   end if
  55.   if newMode = #runON then
  56.     if (getState(oStoryteller, #BarLevel) = 6) and (getState(oStoryteller, #BarGain) = 5) and (getState(oStoryteller, #BarFM) = 8) then
  57.       setState(oStoryteller, #BarOnline, 1)
  58.       setInitialHauntDelay()
  59.     end if
  60.   end if
  61.   setProp(the lsStateData of oStoryteller, #BarMode, list(newMode))
  62.   if whichOne = #power then
  63.     set the castNum of sprite multiFrameSprite to cast getAt(buttonStack, 6)
  64.   else
  65.     set the castNum of sprite multiFrameSprite to cast getProp(buttonStack, getState(oStoryteller, #BarMode))
  66.   end if
  67.   updateStage()
  68.   updateDisplay(oPuppeteer)
  69.   if getState(oStoryteller, #BarOnline) = 1 then
  70.     soundEffect(#BARwarmup)
  71.     preLoadCast(1329)
  72.     loadMultiFrames(#barStartPix)
  73.     wait(#soundStop, #BARwarmup)
  74.     pushVideo()
  75.     wait(#videoStop)
  76.     goTo(#LivingRmBarCU2, #backOff)
  77.     updateDisplay(oPuppeteer)
  78.     wait(120)
  79.     goTo(#LivingRmBarMedW, #backOff)
  80.     updateDisplay(oPuppeteer)
  81.     updateStage()
  82.     setState(oStoryteller, #PeekDisplay, #BARstartup)
  83.     unFreezeInventory()
  84.     peekAlert()
  85.   end if
  86. end
  87.  
  88. on setBarSelection
  89.   global oStoryteller, oPuppeteer
  90.   cursorOff()
  91.   set buttonStack to getProp(the lsMultiFrames of oPuppeteer, #barButtons)
  92.   set multiFrameSprite to 0
  93.   repeat with i = 10 to 48
  94.     if getPos(buttonStack, the castNum of sprite i) then
  95.       set multiFrameSprite to i
  96.       exit repeat
  97.     end if
  98.   end repeat
  99.   set the castNum of sprite multiFrameSprite to cast getAt(buttonStack, 3)
  100.   updateStage()
  101.   if getState(oStoryteller, #BarMode) = #setON then
  102.     set selectionList to [#level, #gain, #FM]
  103.     set oldPosition to getPos(selectionList, getState(oStoryteller, #BarSelection))
  104.     set newPosition to (oldPosition mod 3) + 1
  105.     setProp(the lsStateData of oStoryteller, #BarSelection, list(getAt(selectionList, newPosition)))
  106.     set the castNum of sprite multiFrameSprite to cast getAt(buttonStack, 2)
  107.     set buttonStack to getProp(the lsMultiFrames of oPuppeteer, #barDash)
  108.     set dashSprite to 0
  109.     repeat with i = 10 to 48
  110.       if getPos(buttonStack, the castNum of sprite i) then
  111.         set dashSprite to i
  112.         exit repeat
  113.       end if
  114.     end repeat
  115.     set the castNum of sprite dashSprite to getAt(buttonStack, newPosition)
  116.     updateStage()
  117.   else
  118.     wait(2)
  119.     set the castNum of sprite multiFrameSprite to cast getAt(buttonStack, 2)
  120.     updateStage()
  121.   end if
  122. end
  123.  
  124. on adjustBarSettings upOrDown
  125.   global oStoryteller, oPuppeteer
  126.   cursorOff()
  127.   set whichSetting to getState(oStoryteller, #BarSelection)
  128.   if whichSetting = #level then
  129.     set digitStack to getProp(the lsMultiFrames of oPuppeteer, #levelDigits)
  130.   end if
  131.   if whichSetting = #gain then
  132.     set digitStack to getProp(the lsMultiFrames of oPuppeteer, #gainDigits)
  133.   end if
  134.   if whichSetting = #FM then
  135.     set digitStack to getProp(the lsMultiFrames of oPuppeteer, #FMdigits)
  136.   end if
  137.   set digitSprite to 0
  138.   repeat with i = 10 to 48
  139.     if getPos(digitStack, the castNum of sprite i) then
  140.       set digitSprite to i
  141.       exit repeat
  142.     end if
  143.   end repeat
  144.   set buttonStack to getProp(the lsMultiFrames of oPuppeteer, #barButtons)
  145.   set buttonSprite to 0
  146.   repeat with i = 10 to 48
  147.     if getPos(buttonStack, the castNum of sprite i) then
  148.       set buttonSprite to i
  149.       exit repeat
  150.     end if
  151.   end repeat
  152.   startTimer()
  153.   if upOrDown = #up then
  154.     set the castNum of sprite buttonSprite to cast getAt(buttonStack, 4)
  155.   end if
  156.   if upOrDown = #down then
  157.     set the castNum of sprite buttonSprite to cast getAt(buttonStack, 5)
  158.   end if
  159.   updateStage()
  160.   startTimer()
  161.   set lagTime to 0
  162.   repeat while the stillDown or (the timer < 2)
  163.     if getState(oStoryteller, #BarMode) = #setON then
  164.       if the timer > lagTime then
  165.         if whichSetting = #level then
  166.           set currentLevel to getState(oStoryteller, #BarLevel)
  167.           if upOrDown = #up then
  168.             set newLevel to (currentLevel + 11) mod 10
  169.           end if
  170.           if upOrDown = #down then
  171.             set newLevel to (currentLevel + 9) mod 10
  172.           end if
  173.           set frameStack to getProp(the lsMultiFrames of oPuppeteer, #levelDigits)
  174.           setProp(the lsStateData of oStoryteller, #BarLevel, list(newLevel))
  175.         end if
  176.         if whichSetting = #gain then
  177.           set currentLevel to getState(oStoryteller, #BarGain)
  178.           if upOrDown = #up then
  179.             set newLevel to (currentLevel + 11) mod 10
  180.           end if
  181.           if upOrDown = #down then
  182.             set newLevel to (currentLevel + 9) mod 10
  183.           end if
  184.           set frameStack to getProp(the lsMultiFrames of oPuppeteer, #gainDigits)
  185.           setProp(the lsStateData of oStoryteller, #BarGain, list(newLevel))
  186.         end if
  187.         if whichSetting = #FM then
  188.           set currentLevel to getState(oStoryteller, #BarFM)
  189.           if upOrDown = #up then
  190.             set newLevel to (currentLevel + 11) mod 10
  191.           end if
  192.           if upOrDown = #down then
  193.             set newLevel to (currentLevel + 9) mod 10
  194.           end if
  195.           set frameStack to getProp(the lsMultiFrames of oPuppeteer, #FMdigits)
  196.           setProp(the lsStateData of oStoryteller, #BarFM, list(newLevel))
  197.         end if
  198.         set the castNum of sprite digitSprite to getProp(digitStack, newLevel)
  199.         updateStage()
  200.         set lagTime to lagTime + 30
  201.       end if
  202.     end if
  203.   end repeat
  204.   set the castNum of sprite buttonSprite to cast getAt(buttonStack, 2)
  205.   updateStage()
  206. end
  207.  
  208. on setcurrentPageInRealms suggestion
  209.   global oStoryteller, oPuppeteer, gOriginPoint
  210.   cursorOff()
  211.   set frameStack to getProp(the lsMultiFrames of oPuppeteer, #Realms)
  212.   set pageList to [0, 1, 3, 5, 7, 19, 21, 35, 37, 51, 53, 79, 81, 83]
  213.   set currentPage to getState(oStoryteller, #currentPageInRealms)
  214.   set bookMark to getPos(pageList, currentPage)
  215.   if suggestion = #next then
  216.     if bookMark = count(pageList) then
  217.       setState(oStoryteller, #playerIsReadingRealms, 0)
  218.       updateDisplay(oPuppeteer)
  219.     else
  220.       set pageSprite to 0
  221.       set shadowSprite to 0
  222.       repeat with guess = 10 to 48
  223.         if getPos(frameStack, the castNum of sprite guess) then
  224.           set shadowSprite to guess
  225.           set pageSprite to guess + 1
  226.           exit repeat
  227.         end if
  228.       end repeat
  229.       set myLocation to the loc of sprite pageSprite
  230.       set the castNum of sprite shadowSprite to the castNum of sprite pageSprite
  231.       set the loc of sprite pageSprite to point(300, -300) + gOriginPoint
  232.       updateStage()
  233.       do("puppetTransition " & getProp(getProp(the lsMachineProfile of oPuppeteer, #transitions), #nextPage))
  234.       setProp(the lsStateData of oStoryteller, #currentPageInRealms, list(getAt(pageList, bookMark + 1)))
  235.       set the castNum of sprite pageSprite to getAt(frameStack, bookMark + 3)
  236.       set the loc of sprite pageSprite to myLocation
  237.       if getPos([5, 7, 9, 11], bookMark) then
  238.         soundEffect(#multiPages)
  239.       else
  240.         soundEffect(#pageTurn)
  241.       end if
  242.       updateStage()
  243.     end if
  244.     if bookMark = 1 then
  245.       updateDisplay(oPuppeteer)
  246.     end if
  247.   end if
  248.   if suggestion = #previous then
  249.     if bookMark = 1 then
  250.       setState(oStoryteller, #playerIsReadingRealms, 0)
  251.       updateDisplay(oPuppeteer)
  252.     else
  253.       set pageSprite to 0
  254.       set shadowSprite to 0
  255.       repeat with guess = 10 to 48
  256.         if getPos(frameStack, the castNum of sprite guess) then
  257.           set shadowSprite to guess
  258.           set pageSprite to guess + 1
  259.           exit repeat
  260.         end if
  261.       end repeat
  262.       set myLocation to the loc of sprite pageSprite
  263.       set the castNum of sprite shadowSprite to the castNum of sprite pageSprite
  264.       set the loc of sprite pageSprite to point(300, -300) + gOriginPoint
  265.       updateStage()
  266.       do("puppetTransition " & getProp(getProp(the lsMachineProfile of oPuppeteer, #transitions), #prevPage))
  267.       setProp(the lsStateData of oStoryteller, #currentPageInRealms, list(getAt(pageList, bookMark - 1)))
  268.       set the castNum of sprite pageSprite to getAt(frameStack, bookMark + 1)
  269.       set the loc of sprite pageSprite to myLocation
  270.       if getPos([6, 8, 10, 12], bookMark) then
  271.         soundEffect(#multiPages)
  272.       else
  273.         soundEffect(#pageTurn)
  274.       end if
  275.       updateStage()
  276.     end if
  277.     if bookMark = 2 then
  278.       updateDisplay(oPuppeteer)
  279.     end if
  280.   end if
  281.   if integerp(suggestion) then
  282.     do("puppetTransition " & getProp(getProp(the lsMachineProfile of oPuppeteer, #transitions), #nextPage))
  283.     setProp(the lsStateData of oStoryteller, #currentPageInRealms, list(suggestion))
  284.     soundEffect(#multiPages)
  285.     updateDisplay(oPuppeteer)
  286.   end if
  287. end
  288.  
  289. on setplayerIsReadingRealms suggestion
  290.   global oStoryteller, oPuppeteer, gFreezeInventory
  291.   setProp(the lsStateData of oStoryteller, #playerIsReadingRealms, list(suggestion))
  292.   if suggestion = 1 then
  293.     setProp(the lsStateData of oStoryteller, #currentPageInRealms, [0])
  294.     setTransition(oPuppeteer, #fadeIn)
  295.   else
  296.     setProp(the lsStateData of oStoryteller, #currentPageInRealms, [1])
  297.     setTransition(oPuppeteer, #fadeIn)
  298.   end if
  299. end
  300.  
  301. on setInitialHauntDelay
  302.   global oStoryteller
  303.   set lsDelays to [#DEFAULT: 60, #gettingLate: 45, #veryLate: 30]
  304.   set mileStonesReached to 0
  305.   if inState(#hauntsRemaining, #gazebo1) = 0 then
  306.     set mileStonesReached to mileStonesReached + 1
  307.   end if
  308.   if getState(oStoryteller, #playerHasVideotape) = #usedUp then
  309.     set mileStonesReached to mileStonesReached + 1
  310.   end if
  311.   if getState(oStoryteller, #playerHasCrowbar) = #usedUp then
  312.     set mileStonesReached to mileStonesReached + 1
  313.   end if
  314.   if getState(oStoryteller, #playerHasOscillator) = #usedUp then
  315.     set mileStonesReached to mileStonesReached + 1
  316.   end if
  317.   if inState(#hauntsRemaining, #mirrorMessage) = 0 then
  318.     set mileStonesReached to mileStonesReached + 1
  319.   end if
  320.   if mileStonesReached < 4 then
  321.     set newDelay to getProp(lsDelays, #DEFAULT)
  322.   end if
  323.   if mileStonesReached = 4 then
  324.     set newDelay to getProp(lsDelays, #gettingLate)
  325.   end if
  326.   if mileStonesReached = 5 then
  327.     set newDelay to getProp(lsDelays, #veryLate)
  328.   end if
  329.   setProp(the lsStateData of oStoryteller, #hauntDelay, [newDelay])
  330.   setProp(the lsStateData of oStoryteller, #moveCount, [0])
  331. end
  332.